package com.totoro.tymapping.executor.condition.impl;

import com.totoro.tymapping.constants.ConditionConst;
import com.totoro.tymapping.executor.condition.ConditionExecutor;
import com.totoro.tymapping.utils.ColorUtil;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.List;

/**
 * @author Totoro
 * @version 0.1.0
 * @date 2025/8/13 - 15:38
 * @description
 **/
public class LoreExecutor implements ConditionExecutor {
    @Override
    public Boolean execute(String condition, Player player, ItemStack matchItem) {
        String finalCondition = getFinalCondition(condition, ConditionConst.LORE);
        List<String> lore = matchItem.getItemMeta().getLore();
        for (String loreLine : lore) {
            if (ColorUtil.strEquals(finalCondition, loreLine)) {
                return true;
            }
        }
        return false;
    }
}
